import request from '@/utils/request'

export const requirementsApi = {
  // 获取需求列表
  getRequirements: (params = {}) => {
    return request({
      url: '/api/v1/requirements/',
      method: 'get',
      params
    })
  },

  // 获取需求详情
  getRequirement: (id) => {
    return request({
      url: `/api/v1/requirements/${id}`,
      method: 'get'
    })
  },

  // 创建需求
  createRequirement: (data) => {
    return request({
      url: '/api/v1/requirements',
      method: 'post',
      data
    })
  },

  // 更新需求
  updateRequirement: (id, data) => {
    return request({
      url: `/api/v1/requirements/${id}`,
      method: 'put',
      data
    })
  },

  // 删除需求
  deleteRequirement: (id) => {
    return request({
      url: `/api/v1/requirements/${id}`,
      method: 'delete'
    })
  },

  // 获取需求的测试用例
  getRequirementTestCases: (id, params = {}) => {
    return request({
      url: `/api/v1/requirements/${id}/test-cases`,
      method: 'get',
      params
    })
  }
} 